<template>
    <div>
        <bi-table :data="list" :loading="loading" height="338" >
            <bi-table-column label="页面" name="title" ></bi-table-column>
            <bi-table-column label="选择"  v-slot="{row}" width="80" >
                <bi-button type="primary" size="small" @click="select(row)" >选择</bi-button>
            </bi-table-column>
        </bi-table>
        <bi-pagination v-model="page" :total="total" :count="count" ></bi-pagination>
    </div>
</template>

<script>
export default{
    data(){
        return {
            list:[],
            loading:false,
            page:1,
            count:0,
            total:0,
        }
    },
    emits:['callback'],
    methods:{
        select(row){
            this.$emit('callback','DESIGN-PAGE#'+row.page_id,row.title);
        },
        getList(){
            this.loading = true;
            this.$ajax({
                url:this.$url({'app':'shop','controller':'admin.field','action':'pageList'}),
                data:{
                    page_current:this.page,
                },
                success:(res)=>{
                    this.list = res.list;
                    this.count  = res.count;
                    this.total =res.total;
                    this.loading = false;
                },
            })
        }
    },
    mounted(){
        this.getList();
    }
}
</script>